<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of FoAnnonceDeposerTemoignage
 *
 * @author mssae-9
 */
class FoAnnonceDeposerTemoignageCtrl extends jController {

   /**
    * FO : page d'ajout d'annonce - liste temoignages
    */
    function index() {
       
        global $gJCoord;
        $idOccasion = $this->intParam('idOccasion', 0);
        $iCurrentPage      = $gJCoord->request->getParam('iCurrentPage', 1);


        jClasses::inc('temoignage~temoignageSrv');
        jClasses::inc('commun~parametre');
        jClasses::inc ("commun~CNavBar") ;
        jClasses::inc('publicite~pubSrv');
        jClasses::inc('commun~parametre');
        jClasses::inc("commun~common");

        $pub1 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_1_ID);
        $pub2 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_2_ID);
        $pub3 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_3_ID);
        $pub4 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_4_ID);
        $pub5 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_5_ID);
        $pub6 = pubSrv::getByRubriqueAndLocation(PUB_RUBRIQUE_HOME, PUB_RIGHT_6_ID); 
        $timeout = parametre::get(PARAM_TIMEOUT_PUB);

               
        // Récupération de la liste des temoignages, 10 items, temoignage_id, vendeur_nom, temoignage_description
        if ($iCurrentPage> 1){
            $iDebutListe = ($iCurrentPage-1) * 4; 
        }else{
            $iDebutListe = 0 ;
        }
        $oNavBar = new CNavBar (20, 7) ;
        $oNavBar->iCurrPage = $iCurrentPage;
        $temoignage = temoignageSrv::listeTemoignagesVendeur($iDebutListe,4);	
        $temoignage['annonceThumb'] = temoignageSrv::getAnnonceThumb($temoignage['temoignage']);
        $oNavBar->normalizeBar ($temoignage['nbRecords']) ;
        $oNavBar->mergeBar ();

        $rep = $this->getResponse('htmlFo');
        
        //xml pour le header : title, desc, keywords
        $headerContent = common::readXml(PATH_XML_ANNONCE_AJOUT_TEMOIGNAGE);
		$rep->title						= isset($headerContent->title)?$headerContent->title:'';
		$headerContent->title			= isset($headerContent->title)?$headerContent->title:'' ;
		$headerContent->keywords		= isset($headerContent->keywords)? $headerContent->keywords:'' ;
		$headerContent->desc			= isset($headerContent->desc)? $headerContent->desc:'' ;
		$keywords						= "<meta name='keywords' content='" . $headerContent->keywords . "'>" ;
		$description					= "<meta name='Description' content='" . $headerContent->desc. "'>" ;
        $rep->addHeadContent($keywords);
        $rep->addHeadContent($description);
        // ---
        
        $rep->menusActifs = frontHtmlResponse::MENU_ANNONCE_GESTION ;
        $rep->breadCrumb  = array(frontHtmlResponse::MENU_ACCUEIL, frontHtmlResponse::MENU_ANNONCE_GESTION) ;
        $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'design/front/js/pub.js');

        $rep->bodyTpl = 'annonce~FoAnnonceDeposerTemoignage';
        $rep->body->assign('timeout', $timeout);
        $rep->body->assign('pub1', $pub1);
        $rep->body->assign('pub2', $pub2);
        $rep->body->assign('pub3', $pub3);
        $rep->body->assign('pub4', $pub4);
        $rep->body->assign('pub5', $pub5);
        $rep->body->assign('pub6', $pub6);

        $rep->body->assign("oNavBar", $oNavBar);
        $rep->body->assign('temoignage', $temoignage['temoignage']);
        $rep->body->assign('annonceThumb', $temoignage['annonceThumb']);
        $rep->body->assign('idOccasion', $idOccasion);
       
        return $rep;
    }
}

?>
